//
// Created by yunnan xu on 2020/11/17.
//

#ifndef ANDROIDGRAPHICSDEMOS_BUFFER_H
#define ANDROIDGRAPHICSDEMOS_BUFFER_H

#include <gles3/gl32.h>
#include "GLESUtils.h"


class Buffer
{
public:
    Buffer(){}
};


template<GraphicsAPI api> class VertexBuffer;
template<GraphicsAPI api> class RWBuffer;

template <class BufferType>
class IGLESBuffer
{
public:
    GLuint GetBuffer() {return buffer;}
protected:
    GLuint buffer;
};


template<>
class VertexBuffer<GraphicsAPI::GLESv3> : public Buffer, public IGLESBuffer<VertexBuffer<GraphicsAPI::GLESv3>>
{
public:
    VertexBuffer(GLenum buffer_target, GLenum usage, long offset, long size, const void * data);

};

template<>
class RWBuffer<GraphicsAPI::GLESv3> : public Buffer, public IGLESBuffer<RWBuffer<GraphicsAPI::GLESv3>>
{
public:
    RWBuffer(long number, long each_size, const void * data);
};


#endif //ANDROIDGRAPHICSDEMOS_BUFFER_H
